package com.kejiguan.ui.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.kejiguan.ui.R;
import com.kejiguan.ui.model.ExhibitionNeItem;

import java.util.List;

/**
 * Created by YYY on 16/9/2.
 */
public class AlarmNeAdapter extends RecyclerView.Adapter<NeAdapterVH>{

    private Context mContext;
    private List<ExhibitionNeItem> exhibitionNeItems;
    private LayoutInflater mInflater;
    private int color3;

    public AlarmNeAdapter(Context context, List<ExhibitionNeItem> alarmExhibitionNeItems)
    {
        this.mContext=context;
        this.exhibitionNeItems=alarmExhibitionNeItems;
        mInflater=LayoutInflater.from(mContext);
        color3=mContext.getResources().getColor(R.color.text_color3);
    }

    @Override
    public NeAdapterVH onCreateViewHolder(ViewGroup parent, int viewType) {

        View itemView=mInflater.inflate(R.layout.fragment_ne_list_item_layout,null);
        return new NeAdapterVH(itemView);
    }

    @Override
    public void onBindViewHolder(NeAdapterVH holder, int position) {

        ExhibitionNeItem exhibitionNeItem=exhibitionNeItems.get(position);
        holder.displayNameView.setText(exhibitionNeItem.getExhibitionName());
        holder.displayNameView.setTextColor(color3);
        holder.displayNameView.setBackgroundResource(R.drawable.kjg_item_display_bg3);
    }

    @Override
    public int getItemCount() {

        if (null==exhibitionNeItems)
        {
         return 0;
        }
        return exhibitionNeItems.size();
    }

    public void setExhibitionNeItems(List<ExhibitionNeItem> exhibitionNeItems) {
        this.exhibitionNeItems = exhibitionNeItems;
        notifyDataSetChanged();
    }
}
